home *** CD-ROM | disk | FTP | other *** search
- /* Listing 6 */
-
- /* formtemp.cpp -- use form templates */
-
- /*
- Generate declarations and definitions for
-
- int max(int,int);
- stack<char>
- */
- #define max_TYPE int
- #define stack_ITEM char
- #define stack stack_strings
- #include "def_gen.cpp"
-
- /*
- Generate declarations and definitions for
-
- stack<int,10U>
- */
- #define stack_ITEM int
- #define stack_MAX_ITEMS 10U
- #define stack stack_int_10U
- #include "def_gen.cpp"
-
- #include <iostream.h>
- #include <iomanip.h>
-
- main()
- {
-
- cout << "Which is greater? "
- << 4 << " or " << 5 << "?";
- cout << " Answer: "
- << max(4,5) << "!" << endl;
-
- stack_strings ToDo;
-
- ToDo.push("wash car");
- ToDo.push("cut grass");
- ToDo.push("buy groceries");
- ToDo.push("cash paycheck");
- while (ToDo.top())
- cout << ToDo.pop() << endl;
-
- stack_int_10U CountDown;
-
- for (int i = 1; CountDown.push(new int(i)); i++);
- while (CountDown.top()) {
- cout << *CountDown.top() << " ";
- delete CountDown.pop();
- }
- cout << "Blast Off!" << endl;
- return 0;
- }
-